@extends('backend::layout')
@section('title',$page_title)
@section('content')
    <div class="row match-height">
        @component('backend::component.tab')
           @slot('tabs')
                @foreach($config_group as $group=>$title)
                    <li class="nav-item">
                        <a class="nav-link @if($group == $current_group) active @endif"
                           href="{{route('b_Config_showConfig',['group'=>$group])}}"
                        >
                            {{$title}}
                        </a>
                    </li>
                @endforeach
            @endslot
               <div  class="tab-pane active show">
               <form id="config-update" action="{{route('b_Config_updateValue',['group'=>$current_group])}}" method="post" class="mt-md-h">
                   {{csrf_field()}}
                   @foreach($configs as $config)
                       <div class="form-group">
                           <label>{{$config['title']}}</label>
                           @switch($config['type'])
                                @case(2)
                                @case(3)
                                   @component('backend::component.form.textarea')
                                       @slot('name') {{$config['name']}} @endslot
                                       @slot('value') {{$config['value']}} @endslot
                                   @endcomponent
                               @break
                                @case(4)
                                   @foreach($config['extra'] as $key=>$item)
                                       @component('backend::component.radio')
                                           @slot('name') {{$config['name']}} @endslot
                                           @slot('title') {{$item}} @endslot
                                           @slot('value') {{$key}} @endslot
                                           @slot('checked') @if($key==$config['value']) checked @endif @endslot
                                       @endcomponent
                                   @endforeach
                                   @break
                                @case(5)
                                      @component('backend::component.upload.upload_img',['imgList'=>[$config['value']=>$config['value']]])
                                          @slot('name') {{$config['name']}} @endslot
                                          @slot('title') {{$config['title']}} @endslot
                                          @slot('value') {{$config['value']}} @endslot
                                          @slot('img_num')1 @endslot
                                          @slot('group') website @endslot
                                      @endcomponent
                                    @break
                                @default
                                   @component('backend::component.form.input')
                                       @slot('name') {{$config['name']}} @endslot
                                       @slot('value') {{$config['value']}} @endslot
                                   @endcomponent
                           @endswitch
                           <div class="text-danger mt-1">{{$config['remark']}}</div>
                       </div>
                   @endforeach
                   <button type="button" class="btn btn-md btn-primary ajax-form"
                           data-params='{"formId":"#config-update"}'
                   >
                       修改
                   </button>
               </form>
               </div>
        @endcomponent
    </div>
@endsection
@include('backend::component.upload.upload_js')